import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)  //核心插件
let INC = "INC"
let state = {
    count: 1,
    eag: "薛世斌",
    arr: [
        {
            id: 1
        },
        {
            id: 2
        },
        {
            id: 3
        }
    ]
}

// mutations 必须是同步步请求
const mutations = {
    dec(state, obj) {
        // console.log(obj);
        state.count -= obj.num
    }
}

// actions 可以包含任意的异步操作  没有提到可以把函数名用常量 就不用
const actions = {
    common(params, obj) {
        console.log("46---" + params);
        console.log(obj);
    },

}

const getters = {
    doneTodosCount(state, getter) {
        // console.log(state);
        console.log(getter);
        // return 1
        return state.count += 100
    },
    aaa() {
        return 'aaa'
    }


}
// export default store

// export {
//   store
// }

let moduleB = {
    namespaced: true,
    actions,
    getters,
    state,
    mutations,
}


export default moduleB
